/**
 *  Copyright (c)  2011-2020 Panguso, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Panguso, 
 *  Inc. ("Confidential Information"). You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into with Panguso.
 */

/*

 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.edu.thu.log.filter.logfilter;

import cn.edu.thu.log.read.LogBufferModified;

import java.util.ArrayList;

/**
 * 
 * @author wan
 */
public class LogFilter {
	private ReadContentByTagName readcontent;
	private ArrayList<String> classifyTagList;
/**
 * 
 */
	public LogFilter() {
		readcontent = new ReadContentByTagName();
		classifyTagList = new ArrayList<String>();
	}
/**
 * 
 * @param classifyTags parameter
 */
	public void setClassifyTags(String classifyTags) {
		// System.out.println("classifyTags:"+classifyTags);
		String[] classifyArray = classifyTags.split(",");
		System.out.println("XES classiflyTags:" + classifyTags);
		for (int i = 0; i < classifyArray.length; i++) {
			classifyTagList.add(classifyArray[i]);
		}
		readcontent.setClassifyTagList(classifyTagList);
	}
/**
 * 
 * @param record parameter
 */
	public void filter(LogBufferModified record) {
		for (String tagname : classifyTagList) {
			readcontent.getAndCutContentByTagName(tagname, record);
			// System.out.println("filter get:"+record.getLogBodyMap().get("hit"));
		}
	}
}
